package com.loongtech.core.util;

public class NumberUtil {
	//转成long
	public static long parseLong(Object obj) {
		String str = String.valueOf(obj);
		
		try{
			return Long.parseLong(str);
		}catch(Exception e) {
			return 0l;
		} 
	}
	
	//转成int
	public static int parseInt(Object obj) {
		String str = String.valueOf(obj);
		
		try{
			return Integer.parseInt(str);
		}catch(Exception e) {
			return 0;
		} 
	}
	
	//转成long
	public static boolean isNumber(Object obj) {
		String str = String.valueOf(obj);
		
		try{
			Long.parseLong(str);
		}catch(Exception e) {
			return false;
		} 
		
		return true;
	}
}
